package com.example.myapplication1;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;

import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.RecyclerView;

import com.example.myapplication1.adapter.ConcaterAdapter;
import com.example.myapplication1.dao.ConcaterDao;

public class MainActivity extends AppCompatActivity {

    private static final String TAG =MainActivity.class.getSimpleName();
    private final Activity mContext =MainActivity.this;

    private RecyclerView rec;

    private ConcaterAdapter adapter;

    private ConcaterDao concaterDao;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        initUI();
        initData();
    }

    //绑定控件
    private void initUI(){
        rec=findViewById(R.id.rec);
    }

    //初始化数据
    private void initData(){
        adapter=new ConcaterAdapter(mContext,null);
        concaterDao=new ConcaterDao(mContext);
    }

    //去到添加页面
    public void toAdd(View view){
        Intent intent=new Intent(mContext,AddActivity.class);
        startActivity(intent);
    }

    //注销
    public void toLogout(View view){
        finish();
    }
}